<template>
  <el-dialog
    :visible="lookDialog"
    title="预览文章"
    @close="closeDialog"
    width="820px"
    @open="openDialog"
    :close-on-click-modal="false"
  >
    <div class="loading1" v-loading="isloading">
      <h2 style="margin-top: -5px">{{ lookList.title }}</h2>
      <p>
        <span>{{ formatTime(lookList.createTime) }}</span
        ><span style="margin: 0 8px"> {{ lookList.name }}</span
        ><i class="el-icon-view"></i>
        <span style="margin-left: 8px">{{ lookList.visits }}</span>
      </p>
      <div
        class="lookBox"
        style="
          background: #f5f5f5;
          padding: 13px 10px 0 10px;
          border-top: 1px dashed #d6d6d6;
        "
        v-html="lookList.articleBody"
      ></div>
    </div>
  </el-dialog>
</template>

<script>
// import { profile } from '@/api/base/frame.js'
// import { detail } from '@/api/hmmm/articles.js'
import { parseTime } from '@/utils'
export default {
  props: {
    lookDialog: {
      type: Boolean,
      default: false
    },
    userRow: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      lookList: {
        // 保存预览详情数据
        title: '', // 标题
        articleBody: '', // 文章内容
        createTime: '', // 录入时间
        name: '', // 录入人
        visits: 0 // 浏览次数
      },
      isloading: false
    }
  },
  methods: {
    // 打开弹框的方法
    async openDialog () {
      this.lookList = this.userRow
    },
    // 关闭弹框的方法
    closeDialog () {
      this.$emit('update:lookDialog', false)
    },
    // 转换时间的方法
    formatTime (Time) {
      return parseTime(Time)
    }
  }
}
</script>

<style scoped lang='less'></style>
